<?php

function db_connect() {

    $db_dns = 'mysql:host=127.0.0.1;dbname=eshop;';
    $db_user = 'root';
    $db_password = '';

    try{
	    $dbh = new PDO($db_dns,$db_user,$db_password,array(PDO::MYSQL_ATTR_INIT_COMMAND=>'set names utf8'));
	    //$dbh = new PDO($db_dns,$db_user,$db_password);
	    //$dbh = new PDO("mysql:host=127.0.0.1;dbname=eshop", 'root', '');
		//$dbh->exec("SET NAMES utf8");
		//$dbh->query("set names utf8");
	    return $dbh;
    }catch(PDOException $e){
	    echo $e->getMessage();
	    exit();
    }
}
?>
